package cn.xsshome.xspringboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.stereotype.Component;
/**
 * SpringBoot学习(使用外部Tomcat启动)
 * 修改启动类，继承 SpringBootServletInitializer 并重写 configure 方法
 * @author 小帅丶
 * 2018年1月26日
 */
@SpringBootApplication
@ServletComponentScan
@Component("cn.xsshome.xspringboot.service.*")
public class SpringBootStartApplication extends SpringBootServletInitializer{
	@Override
	protected SpringApplicationBuilder configure(
			SpringApplicationBuilder builder) {
		return builder.sources(SpringBootStartApplication.class);
	}
	/**
	 * main方法充当web.xml启动
	 * @param args
	 */
	public static void main(String[] args) {
		SpringApplication.run(SpringBootStartApplication.class, args);
	}
}
